﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ReservoirModel;

namespace ReservoirDAL
{
    public class LoginDAL
    {
        ReservoirConn conn=new ReservoirConn();
        /// <summary>
        /// 通过该表主键返回一条数据
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public TBUser GetInfo(string Id)
        {
            return conn.TBUser.Find(Id);
        }
        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="UserName"></param>
        /// <param name="PassWord"></param>
        /// <returns></returns>
        public TBUser Login(string UserName, string PassWord)
        {
            TBUser user = conn.TBUser.FirstOrDefault(u => u.Name == UserName && u.Password == PassWord);
            return user;
        }

        //public int Login(string Name, string Pwd)
        //{
        //    int res = conn.TBUser.Where(u => u.Name == Name && u.Password == Pwd).Count();
        //    return res;
        //}
    }
}
